#! /usr/bin/env bash

cd "$(dirname "$0")"
cd ..

for file in screen/*.pid
do
	if [ -f $file ]
	then
		echo $(date +"%Y-%m-%d %H:%M:%S") Halting $(basename $file | sed s/\.pid$// | sed "s/-/ /") process
		./script/kill.sh $file
	fi
done

echo $(date +"%Y-%m-%d %H:%M:%S") Halting radio monitor
airmon-ng stop mon0 > /dev/null
airmon-ng stop mon1 > /dev/null
airmon-ng stop mon2 > /dev/null
airmon-ng stop wlan0 > /dev/null
airmon-ng stop wlan1 > /dev/null
airmon-ng stop wlan2 > /dev/null

echo $(date +"%Y-%m-%d %H:%M:%S") Removing empty capture
find capture -empty -delete

echo $(date +"%Y-%m-%d %H:%M:%S") Removing empty scan
find scan -empty -delete

./script/list.sh

